import request from '@/utils/request'

const prePath = '/bill'
//获取收票登记
export function getReceiptBillPage(params) {
  return request({
    url: prePath + '/billRegistration/page',
    method: 'get',
    params,
  })
}
//现在收票登记
export function createReceiptBill(data) {
  return request({
    url: prePath + '/billRegistration',
    method: 'post',
    data,
  })
}
export function createReceiptBillAndSave(data) {
  return request({
    url: prePath + '/billRegistration/saveAndSubmit',
    method: 'post',
    data,
  })
}
//更新收票登记
export function updateReceiptBill(data) {
  return request({
    url: prePath + '/billRegistration',
    method: 'put',
    data,
  })
}
//
export function recipetById(id) {
  return request({
    url: prePath + '/billRegistration/' + id,
    method: 'get',
  })
}
export function recipetReceivingOrderList(params) {
  return request({
    url: prePath + '/billRegistrationReceivingOrder/all',
    method: 'get',
    params,
  })
}

//收票登记打印
export function getReceiptPrint(data) {
  return request({
    url: prePath + '/billRegistration/print',
    method: 'post',
    data,
  })
}

//提交
export function submitBillRegistration(data) {
  return request({
    url: prePath + '/billRegistration/submit',
    method: 'post',
    data,
  })
}
//撤回
export function retractBillRegistration(data) {
  return request({
    url: prePath + '/billRegistration/retract',
    method: 'post',
    data,
  })
}
//批准
export function ratifyBillRegistration(data) {
  return request({
    url: prePath + '/billRegistration/ratify',
    method: 'post',
    data,
  })
}
//驳回
export function rejectBillRegistration(data) {
  return request({
    url: prePath + '/billRegistration/reject',
    method: 'post',
    data,
  })
}
//重置
export function resetBillRegistration(data) {
  return request({
    url: prePath + '/billRegistration/reset',
    method: 'post',
    data,
  })
}
//删除
export function removeBillRegistration(data) {
  return request({
    url: prePath + '/billRegistration',
    method: 'delete',
    data,
  })
}

// 打印
export function billRegistrationPrint(id) {
  return request({
    url: prePath + '/billRegistration/' + id + '/print',
    method: 'get',
  })
}

//发票主表-分页
export function getReceiptOrderPage(params) {
  return request({
    url: '/receipt/receiptOrder/page',
    method: 'get',
    params,
  })
}
export function getReceiptOrderCustomizeListPage(data) {
  return request({
    url: '/receipt/receiptOrder/customizeList/page',
    method: 'post',
    data,
  })
}
export function getReceiptOrderDetailCustomizeListPage(data) {
  return request({
    url: '/receipt/receiptOrderDetail/customizeList/page',
    method: 'post',
    data,
  })
}
export function getReceiptOrderDetailCustomizeListAll(data) {
  return request({
    url: '/receipt/receiptOrderDetail/customizeList/all',
    method: 'post',
    data,
  })
}
export function getReceiptOrderDetailCustomizeGroups(data) {
  return request({
    url: '/receipt/receiptOrderDetail/customizeGroups',
    method: 'post',
    data,
  })
}
export function getReceiptOrderDetailSumAount(data) {
  return request({
    url: '/receipt/receiptOrderDetail/customizeList/sumAmount',
    method: 'post',
    data,
  })
}
export function getPendReceiptOrderSumAount(data) {
  return request({
    url: '/receipt/pendReceiptOrder/customizeList/sumAmount',
    method: 'post',
    data,
  })
}
//发票主表-新增一条数据
export function createReceiptOrder(data) {
  return request({
    url: '/receipt/receiptOrder',
    method: 'post',
    data,
  })
}
// 保存并提交
export function createReceiptOrderAndSave(data) {
  return request({
    url: '/receipt/receiptOrder/saveAndSubmit',
    method: 'post',
    data,
  })
}
//发票主表-更新一条数据
export function updateReceiptOrder(data) {
  return request({
    url: '/receipt/receiptOrder',
    method: 'put',
    data,
  })
}
//发票主表-删除单条数据
export function deleteReceiptOrder(data) {
  return request({
    url: '/receipt/receiptOrder',
    method: 'delete',
    data,
  })
}

//发票主表-根据{id}获取一条数据
export function getReceiptOrderById(id) {
  return request({
    url: '/receipt/receiptOrder/' + id,
    method: 'get',
  })
}
//发票明细-根据{id}获取一条数据
export function getReceiptOrderDetailById(id) {
  return request({
    url: '/receipt/receiptOrderDetail/' + id,
    method: 'get',
  })
}
//发票明细-获取全部数据
export function getReceiptOrderDetailAll(params) {
  return request({
    url: '/receipt/receiptOrderDetail/all',
    method: 'get',
    params,
  })
}

//发票明细-获取全部数据
export function getReceiptOrderDetailExtAll(params) {
  return request({
    url: '/receipt/receiptOrderDetailExt/all',
    method: 'get',
    params,
  })
}
export function getReceiptOrderDetailExtCustomizeListAll(data) {
  return request({
    url: '/receipt/receiptOrderDetailExt/customizeList/all',
    method: 'post',
    data,
  })
}
//发票主表-提交
export function submitReceiptOrder(data) {
  return request({
    url: '/receipt/receiptOrder/submit',
    method: 'post',
    data,
  })
}
//发票主表-撤回
export function revokeReceiptOrder(data) {
  return request({
    url: '/receipt/receiptOrder/revoke',
    method: 'post',
    data,
  })
}
//发票主表-驳回
export function rejectReceiptOrder(data) {
  return request({
    url: '/receipt/receiptOrder/reject',
    method: 'post',
    data,
  })
}
//发票主表-审核
export function ratifyReceiptOrder(data) {
  return request({
    url: '/receipt/receiptOrder/ratify',
    method: 'post',
    data,
  })
}
//发票主表-作废
export function cancelReceiptOrder(data) {
  return request({
    url: '/receipt/receiptOrder/invalid',
    method: 'post',
    data,
  })
}

//待开发票-分页查询
export function getPendReceiptOrderPage(params) {
  return request({
    url: '/receipt/pendReceiptOrder/page',
    method: 'get',
    params,
  })
}
export function getPendReceiptOrderCustomizeListPage(data) {
  return request({
    url: '/receipt/pendReceiptOrder/customizeList/page',
    method: 'post',
    data,
  })
}
//待开发票-分页查询
export function getPendReceiptOrderSelectPage(data) {
  return request({
    url: '/receipt/pendReceiptOrder/selectPage',
    method: 'post',
    data,
  })
}
//待开发票-查询
export function getPendReceiptOrderSelectAll(params) {
  return request({
    url: '/receipt/pendReceiptOrder/selectAll',
    method: 'get',
    params,
  })
}
//导出excel
export function excelReceiptOrder(data) {
  return request({
    url: '/receipt/receiptOrder/excel',
    responseType: 'blob',
    method: 'post',
    data,
  })
}
export function exceReceiptOrderDetailList(data) {
  return request({
    url: '/receipt/receiptOrderDetail/excel',
    responseType: 'blob',
    method: 'post',
    data,
  })
}
//导出excel
export function excelReceiptOrderDetail(data) {
  return request({
    url: '/receipt/receiptOrder/excelDetail',
    responseType: 'blob',
    method: 'post',
    data,
  })
}
// 打印订单
export function printReceiptOrder(data) {
  return request({
    url: '/receipt/receiptOrder/print',
    method: 'post',
    data,
  })
}
// 打印明细
export function printReceiptOrderDetail(data) {
  return request({
    url: '/receipt/receiptOrder/printDetail',
    method: 'post',
    data,
  })
}
export function downloadFileBillRegistration(params) {
  return request({
    url: prePath + '/billRegistration/download/file',
    method: 'get',
    responseType: 'blob',
    params,
  })
}
export function downloadFileReceiptOrder(params) {
  return request({
    url: '/receipt/receiptOrder/download/file',
    method: 'get',
    responseType: 'blob',
    params,
  })
}

// 一键冲销
export function oneButtonWriteOff(data) {
  return request({
    url: '/receipt/pendReceiptOrder/oneButtonWriteOff',
    method: 'post',
    data,
  })
}
// 冲销详情
export function pendReceiptWriteOffRecord(params) {
  return request({
    url: '/receipt/pendReceiptWriteOffRecord/page',
    method: 'get',
    params,
  })
}
//待开票导出
export function receiptPendReceiptOrderExcel(data) {
  return request({
    url: `/receipt/pendReceiptOrder/excel`,
    method: 'post',
    data,
    responseType: 'blob',
  })
}

// 应付管理
// 列表
export function getShouldPayOrder(data) {
  return request({
    url: '/receipt/shouldPayOrder/customizeList/page',
    method: 'post',
    data,
  })
}
// 新增修改添加发票
export function receiptOrderDetail(params) {
  return request({
    url: '/receipt/receiptOrderDetail/getForShouldPay',
    method: 'get',
    params,
  })
}
// 修改获取已选择发票信息
export function shouldPayOrderDetailAll(params) {
  return request({
    url: '/receipt/shouldPayOrderDetail/all',
    method: 'get',
    params,
  })
}
// 获取详情
export function getShouldPayOrderDetails(id) {
  return request({
    url: '/receipt/shouldPayOrder/' + id,
    method: 'get',
  })
}
// 明细
export function getshouldPayOrderDetail(data) {
  return request({
    url: '/receipt/shouldPayOrderDetail/customizeList/page',
    method: 'post',
    data,
  })
}
// 支付
export function shouldPayOrderPay(data) {
  return request({
    url: '/receipt/shouldPayOrder/pay',
    method: 'post',
    data,
  })
}
// 取消支付
export function shouldPayOrderPayCancel(data) {
  return request({
    url: '/receipt/shouldPayOrder/payCancel',
    method: 'post',
    data,
  })
}
// 提交新增
export function shouldPayOrderSubmit(data) {
  return request({
    url: '/receipt/shouldPayOrder',
    method: 'post',
    data,
  })
}
// 明细分组
export function shouldPayOrderDetailGrops(data) {
  return request({
    url: '/receipt/shouldPayOrderDetail/customizeGroups',
    method: 'post',
    data,
  })
}
export function customizeListAll(data) {
  return request({
    url: '/receipt/shouldPayOrderDetail/customizeList/all',
    method: 'post',
    data,
  })
}
// 提交修改
export function shouldPayOrderUpdate(data) {
  return request({
    url: '/receipt/shouldPayOrder',
    method: 'put',
    data,
  })
}
// 删除
export function deleteShouldPayOrder(data) {
  return request({
    url: '/receipt/shouldPayOrder',
    method: 'delete',
    data,
  })
}
//导出excel
export function excelShouldPayOrder(data) {
  return request({
    url: '/receipt/shouldPayOrder/excelList',
    responseType: 'blob',
    method: 'post',
    data,
  })
}
//导出excel
export function excelDetailList(data) {
  return request({
    url: '/receipt/shouldPayOrder/excelDetailList',
    responseType: 'blob',
    method: 'post',
    data,
  })
}

//导出excel
export function excelShouldPayOrderDetail(data) {
  return request({
    url: '/receipt/shouldPayOrder/excelOrder',
    responseType: 'blob',
    method: 'post',
    data,
  })
}

// 打印订单
export function printShouldPayOrderOrder(data) {
  return request({
    url: '/receipt/shouldPayOrder/print',
    method: 'post',
    data,
  })
}
// 打印明细
export function printShouldPayOrderDetail(data) {
  return request({
    url: '/receipt/shouldPayOrder/printDetail',
    method: 'post',
    data,
  })
}
